import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: HomeView,
    redirect: '/admin/index',
    children: [
      // 首页
      {
        path: '/admin/index',
        component: () => import('../views/admin/AdminIndexView.vue')
      },
      // 账号管理
      {
        path: '/admin/account/user',
        component: () => import('../views/admin/account/UserListView.vue')
      },
      {
        path: '/admin/account/user/add-new',
        component: () => import('../views/admin/account/UserAddNewView.vue')
      },
      // 菜品管理
      {
        path: '/admin/menu/dish-category',
        component: () => import('../views/admin/menu/DishCategoryListView.vue')
      },
      {
        path: '/admin/menu/dish-category/add-new',
        component: () => import('../views/admin/menu/DishCategoryAddNewView.vue')
      },
      {
        path: '/admin/menu/dish',
        component: () => import('../views/admin/menu/DishListView.vue')
      },
      {
        path: '/admin/menu/dish/add-new',
        component: () => import('../views/admin/menu/DishAddNewView.vue')
      },
      {
        path: '/temp/chef/list',
        component: () => import('../views/temp/ChefListView')
      },

      {
        path: '/temp/chef/addNew',
        component: () => import('../views/temp/ChefAddNewView')
      }
      ,
      {
        path: '/temp/chef/display',
        component: () => import('../views/temp/DisplayView')
      },
      {
        path: '/temp/chef/person',
        component: () => import('../views/temp/PersonView')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
